//
//  SYUserInformation.m
//  siyanone
//
//  Created by LK-IOS on 2018/3/21.
//  Copyright © 2018年 LK-News. All rights reserved.
//

#import "SYUserInformation.h"

@interface SYUserInformation()


@end


@implementation SYUserInformation

static SYUserInformation *_instance;

+ (instancetype)allocWithZone:(struct _NSZone *)zone
{
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        _instance = [super allocWithZone:zone];
    });
    return _instance;
}

+ (instancetype)sharedInstance
{
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        _instance = [[self alloc] init];
    });
    return _instance;
}

- (id)copyWithZone:(NSZone *)zone
{
    return _instance;
}

- (NSString *)appName
{
    return [[[NSBundle mainBundle] infoDictionary]objectForKey:@"CFBundleName"];
}

-(NSString *)appVersion
{
    return [[[NSBundle mainBundle] infoDictionary]objectForKey:@"CFBundleShortVersionString"];
}


-(NSString *)registrationID
{
    return [[NSUserDefaults standardUserDefaults]objectForKey:@"registrationID"];
}

- (void)setRegistrationID:(NSString *)registrationID
{
    if (!registrationID.length) {
        registrationID = @"0";
    }
    [[NSUserDefaults standardUserDefaults] setObject:registrationID forKey:@"registrationID"];
    [[NSUserDefaults standardUserDefaults] synchronize];
}

@end
